package com.hzqiuxm.tdddemo001.junit5demo;

/**
 * Copyright © 2021年 tdd-demo-001. All rights reserved.
 *
 * @author 临江仙 hzqiuxm@163.com
 * 测试枚举类
 * @date 2021/2/7 10:51
 */
public class Gender {

    public static final Gender Male = new Gender("male");
    public static final Gender FeMale = new Gender("female");

    private String gender;

    public Gender(String s) {
        this.gender = s;
    }

    public String getGender() {
        return this.gender;
    }

    public static Gender parse(String str) {
        System.out.println("工厂方法构建Gender");
        if (str.equals("F")) {
            return FeMale;
        } else if (str.equals("M")) {
            return Male;
        }
        return null;
    }
}
